<template>
  <div class="app-container">
    <a-title @clickPreview="preview" />
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="项目负责人" prop="leader" style="display:none">
        <el-input
          v-model="queryParams.leader"
          placeholder="请输入项目名称"
          clearable
          size="small"
          style="width:240px;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="姓名" prop="nickName">
        <el-input
          v-model="queryParams.nickName"
          placeholder="请输入姓名"
          clearable
          size="small"
          style="width:240px;"
          @input="change($event)"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="员工编号" prop="jobNo">
        <el-input
          v-model="queryParams.jobNo"
          placeholder="请输入员工编号"
          clearable
          size="small"
          style="width:240px;"
          @input="change($event)"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号码" prop="phonenumber">
        <el-input
          v-model="queryParams.phonenumber"
          placeholder="请输入手机号码"
          clearable
          size="small"
          style="width:240px;"
          @input="change($event)"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
        >移除</el-button>
      </el-col>
      <!--<el-col :span="1.5">
        <el-button 
          type="primary"
          plain
          size="mini"
          icon="el-icon-plus"
          :disabled="multiple"
          @click="applyAccounts"
        >申请开通账号</el-button>
      </el-col>-->
    </el-row>

    <el-table
      stripe
      v-loading="loading"
      :data="personnelList"
      @selection-change="handleSelectionChange"
      @sort-change="tableSortChange"
      :default-sort="{prop: 'status', order: 'ascending'}"
    >
      <el-table-column
        type="selection"
        width="55"
        align="center"
        :sort-orders="['ascending', 'descending']"
        sortable="custom"
      />
      <el-table-column
        label="姓名"
        align="center"
        prop="nickName"
        :sort-orders="['ascending', 'descending']"
        sortable="custom"
      />
      <el-table-column
        label="员工编号"
        align="center"
        prop="jobNo"
        :sort-orders="['ascending', 'descending']"
        sortable="custom"
      />
      <el-table-column
        label="手机号码"
        align="center"
        prop="phonenumber"
        :sort-orders="['ascending', 'descending']"
        sortable="custom"
      />
      <el-table-column
        label="用户状态"
        align="center"
        prop="status"
        :sort-orders="['ascending', 'descending']"
        sortable="custom"
      >
        <template slot-scope="scope">
          <el-tag
            v-if="scope.row.status=='正常'"
            type="success"
            disable-transitions
          >{{scope.row.status}}</el-tag>
          <el-tag
            v-if="scope.row.status=='未启用'"
            type="warning"
            disable-transitions
          >{{scope.row.status}}</el-tag>
          <el-tag
            v-if="scope.row.status=='停用'"
            type="danger"
            disable-transitions
          >{{scope.row.status}}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="筹备期项目数" align="center" prop="preparationNo" />
      <el-table-column label="进行中项目数" align="center" prop="processingNo" />
      <el-table-column label="成果交付项目数" align="center" prop="deliveryNo" />
      <el-table-column label="项目总数" align="center" prop="totalNo" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleHistory(scope.row)"
            icon="el-icon-folder-opened"
          >历史项目信息</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加人员对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="900px">
      <el-form
        ref="form"
        :model="addQueryParams"
        :rules="addRules"
        :inline="true"
        label-width="80px"
      >
        <el-form-item label="姓名" prop="nickName">
          <el-input
            v-model="addQueryParams.nickName"
            placeholder="请输入姓名"
            clearable
            size="small"
            @keyup.enter.native="addHandleQuery"
          />
        </el-form-item>
        <el-form-item label="员工编号" prop="jobNo">
          <el-input
            v-model="addQueryParams.jobNo"
            placeholder="请输入员工编号"
            clearable
            size="small"
            @keyup.enter.native="addHandleQuery"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="addHandleQuery">查询</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetAddQuery">重置</el-button>
        </el-form-item>
      </el-form>

      <el-table
        v-loading="loading"
        :data="addPersonnelList"
        @selection-change="handleSelectionChange"
      >
        <el-table-column label="姓名" align="center" prop="nickName" />
        <el-table-column label="员工编号" align="center" prop="jobNo" />
        <el-table-column label="手机号码" align="center" prop="phonenumber" />
        <el-table-column label="状态" align="center" prop="status">
          <template slot-scope="scope">
            <el-tag
              v-if="scope.row.status=='正常'"
              type="success"
              disable-transitions
            >{{scope.row.status}}</el-tag>
            <el-tag
              v-if="scope.row.status=='未启用'"
              type="warning"
              disable-transitions
            >{{scope.row.status}}</el-tag>
            <el-tag
              v-if="scope.row.status=='停用'"
              type="danger"
              disable-transitions
            >{{scope.row.status}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <!--<el-button
              size="mini"
              type="text"
              v-if="scope.row.status=='未启用'"
              @click="applyAccount(scope.row)"
            >申请开通账号</el-button>-->
            <el-button
            :disabled="canClick"
              size="mini"
              type="text"
              icon="el-icon-plus"
              @click="submitAddForm(scope.row)"
            >新增</el-button>
          </template>
        </el-table-column>
      </el-table>

      <!-- <pagination
        v-show="addTotal>0"
        :total="addTotal"
        :page.sync="addQueryParams.pageNum"
        :limit.sync="addQueryParams.pageSize"
        @pagination="addGetList"
      />-->
    </el-dialog>

    <!-- 历史项目信息对话框 -->
    <el-dialog :title="title" :visible.sync="openHistory" width="900px">
      <el-form
        :model="queryHistoryParams"
        ref="queryHistoryForm"
        :inline="true"
        label-width="100px"
      >
        <el-form-item label="用户ID" prop="userId" style="display:none">
          <el-input v-model="queryHistoryParams.userId" disabled />
        </el-form-item>
        <el-form-item label="姓名" prop="nickName">
          <div class="content" style="width: 220px">{{ queryHistoryParams.nickName}}</div>
          <!--<el-input
            v-model="queryHistoryParams.nickName"
            placeholder="请输入姓名"
            clearable
            size="small"
            style="width: 220px"
            @keyup.enter.native="handleHistoryQuery"
            disabled
          />-->
        </el-form-item>
        <el-form-item label="员工编号" prop="jobNo">
          <div class="content" style="width: 220px">{{ queryHistoryParams.jobNo}}</div>
          <!--<el-input
            v-model="queryHistoryParams.jobNo"
            placeholder="请输入员工编号"
            clearable
            size="small"
            style="width: 220px"
            @keyup.enter.native="handleHistoryQuery"
            disabled
          />-->
        </el-form-item>
        <el-form-item label="项目名称">
          <el-input
            v-model="queryHistoryParams.projectName"
            placeholder="请输入项目名称"
            clearable
            size="small"
            style="width: 220px"
            @keyup.enter.native="handleHistoryQuery"
          />
        </el-form-item>
        <el-form-item label="日期">
          <el-date-picker
            v-model="dateRange"
            size="small"
            style="width: 220px"
            value-format="yyyy-MM-dd"
            type="daterange"
            range-separator="-"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleHistoryQuery">查询</el-button>
        </el-form-item>
      </el-form>

      <el-row class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
          >导出报表</el-button>
        </el-col>
      </el-row>

      <el-table
        stripe
        v-loading="loading"
        :data="personnelHistoryList"
        :span-method="objectSpanMethod"
        @selection-change="handleSelectionChange"
      >
        <el-table-column label="项目名称" align="center" prop="projectName" rowspan="2" />
        <el-table-column label="项目代码" align="center" prop="projectCode" />
        <el-table-column label="项目进展" align="center" prop="projectStatus">
          <template slot-scope="scope">
            <el-tag
              v-if="scope.row.projectStatus=='筹备'"
              disable-transitions
            >{{scope.row.projectStatus}}</el-tag>
            <el-tag
              v-if="scope.row.projectStatus=='进行中'"
              type="info"
              disable-transitions
            >{{scope.row.projectStatus}}</el-tag>
            <el-tag
              v-if="scope.row.projectStatus=='成果交付'"
              type="pain"
              disable-transitions
            >{{scope.row.projectStatus}}</el-tag>
            <el-tag
              v-if="scope.row.projectStatus=='项目完成'"
              type="pain"
              disable-transitions
            >{{scope.row.projectStatus}}</el-tag>
            <el-tag
              v-if="scope.row.projectStatus=='项目暂停'"
              type="warning"
              disable-transitions
            >{{scope.row.projectStatus}}</el-tag>
            <el-tag
              v-if="scope.row.projectStatus=='项目终止'"
              type="danger"
              disable-transitions
            >{{scope.row.projectStatus}}</el-tag>
            <el-tag
              v-if="scope.row.projectStatus=='项目作废'"
              type="danger"
              disable-transitions
            >{{scope.row.projectStatus}}</el-tag>
          </template>
        </el-table-column>
        <!-- <el-table-column
          label="项目负责人"
          align="center"
          prop="projectLeaderName"
          :sort-orders="['ascending', 'descending']"
          sortable="custom"
        />-->
        <el-table-column label="当前项目组成员" align="center" prop="projectMemberFlag" />
        <el-table-column label="进入项目组时间" align="center" prop="joinTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.joinTime, '{y}-{m}-{d} ') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="离开项目组时间" align="center" prop="leaveTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.leaveTime, '{y}-{m}-{d} ') }}</span>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="totalHistory>0"
        :total="totalHistory"
        :page.sync="queryHistoryParams.pageNum"
        :limit.sync="queryHistoryParams.pageSize"
        @pagination="getHistoryList"
      />
    </el-dialog>
    <!-- 预览 -->
    <el-dialog :visible.sync="openPreview" width="80%">
      <iframe :src="manualPreviewUrl" frameborder="0" width="100%" height="700px"></iframe>
    </el-dialog>
  </div>
</template>

<script>
import { listPersonnel, getPersonnel, delPersonnel, addPersonnel, updatePersonnel, exportPersonnel, addListPersonnel, historyProjectList, applyAccount, applyAccounts,checkLeaderMember } from "@/api/projectleader/personnelGlance";
import { getInfo } from "@/api/login";
import aTitle from '@/components/Title'

export default {
  name: "Personnel",
  components: { aTitle },
  data () {
    return {
      manualPreviewUrl: null,
      openPreview: false,
      position: null,
      rowSpanArr: [],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      nickNames: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      //添加人员列表总条数
      addTotal: 0,
      canClick:false,
      //历史项目信息列表总条数
      totalHistory: 0,
      // 项目负责人人员表格数据
      personnelList: [],
      // 添加人员表格数据
      addPersonnelList: [],
      // 历史项目信息表格数据
      personnelHistoryList: [],
      // 日期范围
      dateRange: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 历史项目信息是否显示弹出层
      openHistory: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        leader: undefined,
        userId: undefined,
        role: undefined,
      },
      //添加人员查询参数
      addQueryParams: {
        // pageNum: 1,
        // pageSize: 20,
        nickName: undefined,
        jobNo: undefined,
      },
      // 历史项目信息查询参数
      queryHistoryParams: {
        pageNum: 1,
        pageSize: 20,
        userId: undefined,
        nickName: undefined,
        jobNo: undefined,
        projectName: undefined,
        joinTime: undefined
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      addRules: {
        nickName: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ],
        jobNo: [
          { required: true, message: "员工编号不能为空", trigger: "blur" }
        ]
      },
      multipleSelection: [],
      applyFrom: {
        nickName: undefined,
        jobNo: undefined,
        status: undefined
      },
    };
  },
  created () {
    this.queryParams.leader = this.$route.params.id;
    this.getList();
  },
  methods: {
    preview () {
      this.openPreview = true;
      this.manualPreviewUrl = `${this.previewUrl}${encodeURIComponent(
        `${this.operationManual}项目负责人工作台/业务系统操作说明-项目负责人工作台-人员清单管理.xlsx`
      )}&name=${encodeURIComponent("业务系统操作说明-项目负责人工作台-人员清单管理.xlsx")}`;
    },
    /** 查询项目负责人人员列表 */
    getList () {
      this.loading = true;
      listPersonnel(this.queryParams).then(response => {
        this.personnelList = response.rows.map(item => {
          if (item.status === "0") {
            item.status = "正常";
          } else if (item.status === "1") {
            item.status = "停用";
          } else if (item.status === "2") {
            item.status = "未启用";
          }
          return item;
        });
        this.total = response.total;
        this.loading = false;
      });
    },
    addGetList () {
      this.loading = true;
      this.addQueryParams.leader = this.$route.params.id;
      addListPersonnel(this.addQueryParams).then(response => {
        this.addPersonnelList = response.rows.map(item => {
          if (item.status === "0") {
            item.status = "正常";
          } else if (item.status === "1") {
            item.status = "停用";
          } else if (item.status === "2") {
            item.status = "未启用";
          }
          return item;
        });
        this.addTotal = response.total;
        this.loading = false;
      });
    },
    /** 查询历史记录列表 */
    getHistoryList () {
      this.loading = true;
      historyProjectList(this.addDateRange(this.queryHistoryParams, this.dateRange)).then(response => {
        this.personnelHistoryList = response.rows.map(item => {
          item.projectMemberFlag = item.projectMemberFlag === "Y" ? "是" : "否";
          if (item.projectStatus === "0") {
            item.projectStatus = "筹备";
          } else if (item.projectStatus === "1") {
            item.projectStatus = "进行中";
          } else if (item.projectStatus === "2") {
            item.projectStatus = "成果交付";
          } else if (item.projectStatus === "3") {
            item.projectStatus = "项目完成";
          } else if (item.projectStatus === "4") {
            item.projectStatus = "项目暂停";
          } else if (item.projectStatus === "5") {
            item.projectStatus = "项目终止";
          } else if (item.projectStatus === "6") {
            item.projectStatus = "项目作废";
          }
          return item;
        });
        this.totalHistory = response.total;
        this.getRowSpan();
        this.loading = false;

      });
    },
    // 取消按钮
    cancel () {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset () {
      this.form = {
        id: undefined,
        leader: undefined,
        userId: undefined,
        role: undefined,
        remark: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined,
        nickName: undefined,
        jobNo: undefined
      };
      this.resetForm("form");
    },
    // 表单重置
    resetHistory () {
      this.queryHistoryParams.projectName = undefined;
    },
    /** 搜索按钮操作 */
    handleQuery () {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 添加人员搜索按钮操作*/
    addHandleQuery () {
      var $this = this;
      this.$refs["form"].validate(valid => {
        if (valid) {
          debugger
          $this.addQueryParams.leader = this.$route.params.id;
          checkLeaderMember($this.addQueryParams).then(res=>{
            if(res.data != null && res.data>0){
              this.msgError("用户"+$this.addQueryParams.nickName+"已存在人员清单，请勿重复添加！");
            }else{
              this.addGetList();
            }
          });

          // this.addQueryParams.pageNum = 1;
          
        }
      });

    },
    /** 历史项目信息搜索按钮操作 */
    handleHistoryQuery () {
      this.queryHistoryParams.pageNum = 1;
      this.getHistoryList();
    },
    /** 重置按钮操作 */
    resetQuery () {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 添加人员重置操作 */
    resetAddQuery () {
      this.addQueryParams = {
        nickName: undefined,
        jobNo: undefined,
      };
      this.addPersonnelList = [];
    },
    // 多选框选中数据
    handleSelectionChange (selection) {
      this.ids = selection.map(item => item.guid)
      this.nickNames = selection.map(item => item.nickName)
      this.single = selection.length != 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd () {

      this.canClick=false;
      this.reset();
      this.open = true;
      this.title = "添加人员";
      this.addPersonnelList = [];
      this.ids = [];
      // this.addGetList();
    },
    /** 历史项目信息按钮操作 */
    handleHistory (row) {
      this.resetHistory();
      this.queryHistoryParams.userId = row.userId;
      this.queryHistoryParams.nickName = row.nickName;
      this.queryHistoryParams.jobNo = row.jobNo;
      this.openHistory = true;
      this.title = "历史项目信息";
      this.getHistoryList();
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != undefined) {
            updatePersonnel(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          } else {
            addPersonnel(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          }
        }
      });
    },
    /** 提交按钮 */
    submitAddForm: function (row) {

      var $this = this;
      if (row.userId) {
        this.form.userId = row.userId;//添加用户
        this.form.leader = this.$route.params.id;
      } else {
        this.form = {
          nickName: row.nickName,
          jobNo: row.jobNo,
          phonenumber: row.phonenumber,
          status: row.status,
          globalId: row.globalId,
          personnelDept: row.personnelDept,
          leader: this.$route.params.id,
          bpmUserId: row.bpmUserId
        }
      }
      const form = this.form;
      if (row.jobNo.substring(0, 3) !== 'H04') {
        this.$message({
          showClose: true,
          message: "员工编号未正式生成,请联系人事部门！",
          type: "warning"
        });
      } else {
        if (row.status === '未启用') {
          this.$confirm('是否确认添加人员"' + row.nickName + '"，同时给系统管理员发送申请开通账号通知', '警告', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(function () {
            $this.canClick=true;
            return addPersonnel(form)
          })
            .then(response => {
              if (response.code === 200) {
                $this.canClick=false;
                this.msgSuccess("新增成功");
                // this.open = false;
                this.addPersonnelList = [];
                this.getList();
              } else {
                $this.canClick=false;
                this.msgError(response.msg);
              }
            })
            .catch(function () { 
              $this.canClick=false;
            })
        } else {
          this.addPersonnelSec(form);

          /*checkLeaderMember($this.addQueryParams).then(res=>{
            if(res.data != null && res.data>0){
              this.msgError("用户"+$this.addQueryParams.nickName+"已存在人员清单，请勿重复添加！");
            }else{
              this.addPersonnelSec(form);
            }
          });*/

        }
      }
    },
    addPersonnelSec(form){
        addPersonnel(form).then(response => {
            if (response.code === 200) {
              this.msgSuccess("新增成功");
              // this.open = false;
              this.addPersonnelList = [];
              this.getList();
            } else {
              this.msgError(response.msg);
            }
          });
    },
    /** 删除按钮操作 */
    handleDelete (row) {
      const ids = row.guid || this.ids;
      const nickNames = row.nickName || this.nickNames;
      const delForm = {
        guids: ids,
        leader: this.$route.params.id
      }
      this.$confirm('是否确认移除人员"' + nickNames + '"？* 移除人员的同时会从项目成员中移除此人', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return delPersonnel(delForm);
        this.getList();
      }).then(() => {
        this.msgSuccess("移除成功");
        this.getList();
      }).catch(function () { });
    },
    /** 导出按钮操作 */
    handleExport () {
      const queryHistoryParams = this.queryHistoryParams;
      this.$confirm('是否确认导出历史项目信息报表?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return exportPersonnel(queryHistoryParams);
      }).then(response => {
        this.download(response.msg);
      }).catch(function () { });
    },
    tableSortChange (column) {
      this.queryParams.pageNum = 1;
      if (column.order === "descending") {
        this.queryParams.sortBy = column.prop;
        this.queryParams.order = "desc";
      } else {
        this.queryParams.sortBy = column.prop;
        this.queryParams.order = "asc";
      }
      this.getList();
    },
    // tableSortChangeHistory (column) {
    //   this.queryHistoryParams.pageNum = 1;
    //   if (column.order === "descending") {
    //     this.queryHistoryParams.sortBy = column.prop;
    //     this.queryHistoryParams.order = "desc";
    //   } else {
    //     this.queryHistoryParams.sortBy = column.prop;
    //     this.queryHistoryParams.order = "asc";
    //   }
    //   this.getHistoryList();
    // },
    getRowSpan () {
      this.rowSpanArr = []
      this.personnelHistoryList.forEach((item, index) => {
        if (index == 0) {
          this.rowSpanArr.push(1)
          this.position = 0
        } else {
          if (
            this.personnelHistoryList[index].projectId ==
            this.personnelHistoryList[index - 1].projectId
          ) {
            this.rowSpanArr[this.position] += 1 //项目名称相同，合并到同一个数组中
            this.rowSpanArr.push(0)
            this.personnelHistoryList[index].projectName = this.personnelHistoryList[
              index - 1
            ].projectName
            this.personnelHistoryList[index].projectCode = this.personnelHistoryList[
              index - 1
            ].projectCode
            this.personnelHistoryList[index].projectStatus = this.personnelHistoryList[
              index - 1
            ].projectStatus
            this.personnelHistoryList[index].projectMemberFlag = this.personnelHistoryList[
              index - 1
            ].projectMemberFlag

          } else {
            this.rowSpanArr.push(1)
            this.position = index
          }
        }
      })
    },
    objectSpanMethod ({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 3) {
        const _row = this.rowSpanArr[rowIndex]
        return {
          rowspan: _row, // 行
          colspan: _row > 0 ? 1 : 0 // 列
        }
      }
    },
    //申请开通账号
    applyAccount (row) {
      this.applyFrom = {
        nickName: row.nickName,
        jobNo: row.jobNo,
        status: row.status,
      }
      // console.log("applyFrom:"+JSON.stringify(applyFroms))
      applyAccount(this.applyFrom).then(res => {
        if (res.code === 200) {
          this.msgSuccess("申请成功")
          this.getList();
        }
        else if (res.code === 500) {
          this.msgError(res.msg)
          this.getList();
        }
      })
    },
    applyAccounts (row) {
      const ids = row.guid || this.ids;
      // console.log("applyFrom:"+JSON.stringify(applyFroms))
      applyAccounts(ids).then(res => {
        if (res.code === 200) {
          this.msgSuccess("申请成功")
          this.getList();
        }
        else if (res.code === 500) {
          this.msgError(res.msg)
          this.getList();
        }
      })
    },change(e) {
      this.$forceUpdate();
    }
  }
};
</script>
<style lang="scss" scoped>
.content {
  font-size: 14px;
  word-break: break-word;
  margin-top: 9px;
  line-height: 1.15;
}
</style>